package controller

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"tg-bot/common"
	"tg-bot/controller/request"
	"tg-bot/model"
	"tg-bot/rabbitmq"
)

func Login(c *gin.Context) {
	userFundList, err := model.GetUserByPrivate(model.GetUserColumn(), "UI207636530401902592", model.ChoiceUseDB(""))

	rabbitmq.SendMQMessage(
		rabbitmq.QueueBo{
			Id:         "1234",
			Data:       "123415",
			QueueName:  rabbitmq.QUEUE_LOGGER,
			Exchange:   rabbitmq.EXCHANGE_COMMON,
			RoutingKey: "go.key.logger.text",
		})

	if err != nil {
		common.SysLog("获取请求数据失败")
	}
	c.JSON(http.StatusOK, request.ResponseOK(userFundList))
}

func Register(c *gin.Context) {
	var queue rabbitmq.QueueBo
	err := c.ShouldBind(&queue)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
	}
	rabbitmq.SendMQMessage(queue)
	c.JSON(http.StatusOK, gin.H{"code": "200", "success": true})
}
